package me.learningandroid.ch2_5.returnstackdemo;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class SingleTaskActivity extends BaseActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        TextView textView1 = findViewById(R.id.textView1);
        TextView textView2 = findViewById(R.id.textView2);
        TextView textView3 = findViewById(R.id.textView3);
        Button button1 = findViewById(R.id.button1);
        Button button2 = findViewById(R.id.button2);
        Button button3 = findViewById(R.id.button3);
        Button button4 = findViewById(R.id.button4);
        Button button5 = findViewById(R.id.button5);

        textView1.setVisibility(View.INVISIBLE);
        textView2.setVisibility(View.INVISIBLE);

        button1.setOnClickListener((view) -> {
            MainActivity.startActivity(this);
        });
        button2.setOnClickListener((view) -> {
            SingleTopActivity.startActivity(this);
        });
        button3.setOnClickListener((view) -> {
            SingleTaskActivity.startActivity(this);
        });
        button4.setOnClickListener((view) -> {
            finish();
        });
        button5.setOnClickListener((view) -> {
            oneClickFinish();
        });
    }

    public static void startActivity(Context context) {
        Intent intent = new Intent(context, SingleTaskActivity.class);
        context.startActivity(intent);
    }
}